package com.google.code.virtualhockey.vhx.server.servlet

import javax.servlet.{ServletContextEvent, ServletContextListener}
import com.google.code.virtualhockey.vhx.sds.Sds
import com.google.code.virtualhockey.vhx.server.model.Schema
import java.util.logging.Logger

/**
 * Encapsulates all activities that must be carried out once to boot up and later on to shutdown VHX.
 */
class VhxBoot extends ServletContextListener {

  private val _log = Logger.getLogger( classOf[VhxBoot].getName )

  def contextDestroyed( evt: ServletContextEvent ) {

  }

  def contextInitialized( evt: ServletContextEvent ) {
    val startTime = System.currentTimeMillis();

    // Initialise persistence
    //
    Sds.setSchema( Schema )
    
    _log.info( "VHX was booted up in " + ( System.currentTimeMillis() - startTime ) + " ms." )
  }
}
